<?php

/**
 * Pessoa filter form base class.
 *
 * @package    tcc
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasePessoaFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'contato_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Contato'), 'add_empty' => true)),
      'nome'            => new sfWidgetFormFilterInput(),
      'data_nascimento' => new sfWidgetFormFilterInput(),
      'estadocivil'     => new sfWidgetFormFilterInput(),
      'cpf'             => new sfWidgetFormFilterInput(),
      'rg'              => new sfWidgetFormFilterInput(),
      'endereco_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Endereco'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'contato_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Contato'), 'column' => 'id')),
      'nome'            => new sfValidatorPass(array('required' => false)),
      'data_nascimento' => new sfValidatorPass(array('required' => false)),
      'estadocivil'     => new sfValidatorPass(array('required' => false)),
      'cpf'             => new sfValidatorPass(array('required' => false)),
      'rg'              => new sfValidatorPass(array('required' => false)),
      'endereco_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Endereco'), 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('pessoa_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Pessoa';
  }

  public function getFields()
  {
    return array(
      'id'              => 'Number',
      'contato_id'      => 'ForeignKey',
      'nome'            => 'Text',
      'data_nascimento' => 'Text',
      'estadocivil'     => 'Text',
      'cpf'             => 'Text',
      'rg'              => 'Text',
      'endereco_id'     => 'ForeignKey',
    );
  }
}
